package com.sec.android.app.myfiles.module.local.category;

import android.content.Context;
import android.os.Bundle;

import com.sec.android.app.myfiles.fragment.AbsMyFilesFragment;
import com.sec.android.app.myfiles.log.Log;
import com.sec.android.app.myfiles.module.abstraction.AbsReloadStrategyImp;
import com.sec.android.app.myfiles.module.abstraction.FileRecord;
import com.sec.android.app.myfiles.navigation.NavigationInfo;

/**
 * Created by daesu83.kim on 2015-07-22.
 */
public class CategoryReloadStrategyImp extends AbsReloadStrategyImp {

    public CategoryReloadStrategyImp(Context context, NavigationInfo navigationInfo) {
        super(context, navigationInfo);
    }

    @Override
    public void reload(ReloadCause cause, Bundle extras, int event) {
        Log.d(this, "reload called via " + cause);
        if (mNavigationInfo.getStorageType() == FileRecord.StorageType.Category &&
                (cause == ReloadCause.ContentChanged  || cause == ReloadCause.MediaScanFinished)) {
            AbsMyFilesFragment curFragment = mNavigationInfo.getCurFragment();
            if (curFragment != null) {
                curFragment.reload();
            }
        }
    }
}
